package com.dk.fectory;

import com.dk.pojo.CodePart;
import com.dk.service.CodeService;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @author zh
 * @Description TODO
 * @createTime 2023/4/20
 */
@Component
@CodeType(codeType = "NOWDATE")//当前日期
public class NOWDATE implements CodeService {


    @Override
    public String code(CodePart codePart) {
        LocalDate now = LocalDate.now();
        DateTimeFormatter mm = DateTimeFormatter.ofPattern(codePart.getDateFormat());
        return now.format(mm);
    }
}
